package com.model;

/**
 * Created by LPFma on 2016/12/4 0004.
 */
public class UpdateSelfInfoModel {
    private static final String valid = "valid";
    private static final String invalid = "invalid";
    public static String isPasswdValid(String passwd){
        if (passwd.length() < 6 || passwd.length() > 16) {
            return invalid;
        }

        for (int i = 0; i < passwd.length(); ++i) {
            char ch = passwd.charAt(i);
            if (!(ch >= '0' && ch <= '9'
                    || ch >= 'a' && ch <= 'z'
                    || ch >= 'A' && ch <= 'Z')){
                return invalid;
            }
        }

        return valid;
    }

    public static String isNicknameValid(String nickname){
        if(nickname.length() > 20){
            return invalid;
        }

        return valid;
    }

    public static String isSexValid(String sex){
        if(sex.equals("M") || sex.equals("F")){
            return valid;
        }

        return invalid;
    }

    public static String isSignatureValid(String signature){
        if(signature.length() > 140){
            return invalid;
        }

        return valid;
    }
}
